package com.fufu.algorithem.recursion;

/**
 * 递归的应用
 * @author: BlcakTiger
 * @date: 2023/2/18 17:17
 * @contact: hsf6661@163.com
 */
public class Demo {

    public static void main(String[] args) {
        int res = test(5);
        System.out.println("5的阶层："+res);
    }

    /**
     * 计算阶层
     * @param n 阶层数
     * @return 返回n的阶层
     */
    public static int test(int n){
        if (n==1){
            return 1;
        }
        return n * test(n-1);
    }
}
